/**
 * 
 */
package com.mc.fastjson;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * @author w.weizhen
 *
 */
public class Operation {

    /**
     * @param args
     */
    public static void main(String[] args) {
        commonly();
        
        addAll();
    }
    
    public static void commonly()
    {
        JSONObject data = new JSONObject();
        data.put("xxxxx", "yyyyy");
        System.out.println(data.toString());
        data.put("xxxxxyy", data.getString("xxxxx"));
        data.remove("xxxxx");
        System.out.println(data.toString());
    }
    
    public static void addAll()
    {
        JSONArray datas = new JSONArray();
        
        for (int i = 0; i < 10; i++) {
            JSONArray datax = new JSONArray();
            for (int j = 0; j < Math.floor(Math.random() * Math.floor(3)); j++) {
                JSONObject data = new JSONObject();
                data.put(Math.floor(Math.random() * Math.floor(100))+"", Math.floor(Math.random() * Math.floor(100))+"");
                datax.add(data);
            }
            System.out.println(datax.toString());
            datas.addAll(datax);
        }
        System.out.println(datas.toString());
        
    }
    
}